package com.deerblock.utils;

import android.os.CountDownTimer;
import android.widget.Button;

public class CountDownTimerUtils extends CountDownTimer {
  private Button timeButton;
  public CountDownTimerUtils(Button button, long millisInFuture, long countDownInterval) {
    super(millisInFuture, countDownInterval);
    this.timeButton = button;
  }

  @Override
  public void onTick(long l) {
    timeButton.setClickable(false);
    timeButton.setText(l/1000+"秒后重新发送");
  }

  @Override
  public void onFinish() {
    //重新给Button设置文字
    timeButton.setText("重新获取");
    //设置可点击
    timeButton.setClickable(true);
  }
}
